home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / test_future.py < prev    next >
Text File  |  2005-11-19  |  1KB  |  48 lines

  1. # Test various flavors of legal and illegal future statements
  2.  
  3. from test.test_support import unload
  4. import re
  5.  
  6. rx = re.compile('\((\S+).py, line (\d+)')
  7.  
  8. def check_error_location(msg):
  9.     mo = rx.search(msg)
  10.     print "SyntaxError %s %s" % mo.group(1, 2)
  11.  
  12. # The first two tests should work
  13.  
  14. unload('test_future1')
  15. from test import test_future1
  16.  
  17. unload('test_future2')
  18. from test import test_future2
  19.  
  20. unload('test_future3')
  21. from test import test_future3
  22.  
  23. # The remaining tests should fail
  24. try:
  25.     from test import badsyntax_future3
  26. except SyntaxError, msg:
  27.     check_error_location(str(msg))
  28.  
  29. try:
  30.     from test import badsyntax_future4
  31. except SyntaxError, msg:
  32.     check_error_location(str(msg))
  33.  
  34. try:
  35.     from test import badsyntax_future5
  36. except SyntaxError, msg:
  37.     check_error_location(str(msg))
  38.  
  39. try:
  40.     from test import badsyntax_future6
  41. except SyntaxError, msg:
  42.     check_error_location(str(msg))
  43.  
  44. try:
  45.     from test import badsyntax_future7
  46. except SyntaxError, msg:
  47.     check_error_location(str(msg))
  48.